<?php

/*
 * 
 * http sockets
 * 
 */
namespace App\Http\Traits;

use GuzzleHttp\Client;
/**
 *
 * @author Administrator
 */
trait BroadcastHttpPush {
    
    public function push($data)

    {

        $baseUrl = env('WEBSOCKET_BASEURL', 'http://192.168.1.33:6001/');

        $appId = env('WEBSOCKET_APPID', 'bd4f52620bee4e79');

        $key = env('WEBSOCKET_KEY', 'e8a8a1a3775ece691974db6feb8450a2');

        $httpUrl = $baseUrl . 'apps/' . $appId . '/events?auth_key=' . $key;

       

        $client = new Client([

            'base_uri' => $httpUrl,

            'timeout' => 2,
            

        ]);

        $response = $client->post($httpUrl, [

            'json' => $data

        ]);

        $code = $response->getStatusCode();

    }
}
